.class public Lde/dealdoktor/app/adapter/CommentsListAdapter;
.super Landroid/widget/BaseAdapter;
.source "CommentsListAdapter.java"


# instance fields
.field private asyncImageLoader:Lde/dealdoktor/app/util/AsyncImageLoader;

.field public commentList:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList",
            "<",
            "Lde/dealdoktor/app/data/CommentDAO;",
            ">;"
        }
    .end annotation
.end field

.field private context:Lde/dealdoktor/app/activities/Comments;

.field private defaultBitmap:Landroid/graphics/Bitmap;

.field private posts:Ljava/util/ArrayList;
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "Ljava/util/ArrayList",
            "<",
            "Lde/dealdoktor/app/data/PostDAO;",
            ">;"
        }
    .end annotation
.end field


# direct methods
.method public constructor <init>(Lde/dealdoktor/app/activities/Comments;)V
    .locals 2
    .parameter "context"

    .prologue
    .line 40
    invoke-direct {p0}, Landroid/widget/BaseAdapter;-><init>()V

    .line 42
    iput-object p1, p0, Lde/dealdoktor/app/adapter/CommentsListAdapter;->context:Lde/dealdoktor/app/activities/Comments;

    .line 44
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lde/dealdoktor/app/adapter/CommentsListAdapter;->commentList:Ljava/util/ArrayList;

    .line 45
    new-instance v0, Ljava/util/ArrayList;

    invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V

    iput-object v0, p0, Lde/dealdoktor/app/adapter/CommentsListAdapter;->posts:Ljava/util/ArrayList;

    .line 47
    new-instance v0, Lde/dealdoktor/app/util/AsyncImageLoader;

    invoke-direct {v0}, Lde/dealdoktor/app/util/AsyncImageLoader;-><init>()V

    iput-object v0, p0, Lde/dealdoktor/app/adapter/CommentsListAdapter;->asyncImageLoader:Lde/dealdoktor/app/util/AsyncImageLoader;

    .line 48
    invoke-virtual {p1}, Lde/dealdoktor/app/activities/Comments;->getResources()Landroid/content/res/Resources;

    move-result-object v0

    const v1, 0x7f02000a

    invoke-static {v0, v1}, Landroid/graphics/BitmapFactory;->decodeResource(Landroid/content/res/Resources;I)Landroid/graphics/Bitmap;

    move-result-object v0

    iput-object v0, p0, Lde/dealdoktor/app/adapter/CommentsListAdapter;->defaultBitmap:Landroid/graphics/Bitmap;

    .line 50
    return-void
.end method

.method static synthetic access$1(Lde/dealdoktor/app/adapter/CommentsListAdapter;)Ljava/util/ArrayList;
    .locals 1
    .parameter

    .prologue
    .line 37
    iget-object v0, p0, Lde/dealdoktor/app/adapter/CommentsListAdapter;->posts:Ljava/util/ArrayList;

    return-object v0
.end method

.method static synthetic access$2(Lde/dealdoktor/app/adapter/CommentsListAdapter;)Lde/dealdoktor/app/activities/Comments;
    .locals 1
    .parameter

    .prologue
    .line 34
    iget-object v0, p0, Lde/dealdoktor/app/adapter/CommentsListAdapter;->context:Lde/dealdoktor/app/activities/Comments;

    return-object v0
.end method


# virtual methods
.method public addData(Ljava/util/ArrayList;Ljava/util/ArrayList;)V
    .locals 1
    .parameter
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/ArrayList",
            "<",
            "Lde/dealdoktor/app/data/CommentDAO;",
            ">;",
            "Ljava/util/ArrayList",
            "<",
            "Lde/dealdoktor/app/data/PostDAO;",
            ">;)V"
        }
    .end annotation

    .prologue
    .line 78
    .local p1, c:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lde/dealdoktor/app/data/CommentDAO;>;"
    .local p2, posts:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lde/dealdoktor/app/data/PostDAO;>;"
    if-eqz p1, :cond_0

    .line 79
    iget-object v0, p0, Lde/dealdoktor/app/adapter/CommentsListAdapter;->commentList:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->addAll(Ljava/util/Collection;)Z

    .line 80
    iget-object v0, p0, Lde/dealdoktor/app/adapter/CommentsListAdapter;->posts:Ljava/util/ArrayList;

    invoke-virtual {v0, p2}, Ljava/util/ArrayList;->addAll(Ljava/util/Collection;)Z

    .line 81
    invoke-virtual {p0}, Lde/dealdoktor/app/adapter/CommentsListAdapter;->notifyDataSetChanged()V

    .line 83
    :cond_0
    return-void
.end method

.method public addDataToTop(Ljava/util/ArrayList;)V
    .locals 2
    .parameter
    .annotation system Ldalvik/annotation/Signature;
        value = {
            "(",
            "Ljava/util/ArrayList",
            "<",
            "Lde/dealdoktor/app/data/CommentDAO;",
            ">;)V"
        }
    .end annotation

    .prologue
    .line 73
    .local p1, c:Ljava/util/ArrayList;,"Ljava/util/ArrayList<Lde/dealdoktor/app/data/CommentDAO;>;"
    iget-object v0, p0, Lde/dealdoktor/app/adapter/CommentsListAdapter;->commentList:Ljava/util/ArrayList;

    const/4 v1, 0x0

    invoke-virtual {v0, v1, p1}, Ljava/util/ArrayList;->addAll(ILjava/util/Collection;)Z

    .line 74
    invoke-virtual {p0}, Lde/dealdoktor/app/adapter/CommentsListAdapter;->notifyDataSetChanged()V

    .line 75
    return-void
.end method

.method public clear()V
    .locals 1

    .prologue
    .line 53
    iget-object v0, p0, Lde/dealdoktor/app/adapter/CommentsListAdapter;->commentList:Ljava/util/ArrayList;

    invoke-virtual {v0}, Ljava/util/ArrayList;->clear()V

    .line 54
    invoke-virtual {p0}, Lde/dealdoktor/app/adapter/CommentsListAdapter;->notifyDataSetChanged()V

    .line 55
    return-void
.end method

.method public getCount()I
    .locals 1

    .prologue
    .line 59
    iget-object v0, p0, Lde/dealdoktor/app/adapter/CommentsListAdapter;->commentList:Ljava/util/ArrayList;

    invoke-virtual {v0}, Ljava/util/ArrayList;->size()I

    move-result v0

    return v0
.end method

.method public getItem(I)Lde/dealdoktor/app/data/CommentDAO;
    .locals 1
    .parameter "position"

    .prologue
    .line 64
    iget-object v0, p0, Lde/dealdoktor/app/adapter/CommentsListAdapter;->commentList:Ljava/util/ArrayList;

    invoke-virtual {v0, p1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v0

    check-cast v0, Lde/dealdoktor/app/data/CommentDAO;

    return-object v0
.end method

.method public bridge synthetic getItem(I)Ljava/lang/Object;
    .locals 1
    .parameter

    .prologue
    .line 1
    invoke-virtual {p0, p1}, Lde/dealdoktor/app/adapter/CommentsListAdapter;->getItem(I)Lde/dealdoktor/app/data/CommentDAO;

    move-result-object v0

    return-object v0
.end method

.method public getItemId(I)J
    .locals 2
    .parameter "position"

    .prologue
    .line 69
    int-to-long v0, p1

    return-wide v0
.end method

.method public getView(ILandroid/view/View;Landroid/view/ViewGroup;)Landroid/view/View;
    .locals 21
    .parameter "position"
    .parameter "convertView"
    .parameter "parent"

    .prologue
    .line 87
    move-object/from16 v0, p0

    iget-object v0, v0, Lde/dealdoktor/app/adapter/CommentsListAdapter;->commentList:Ljava/util/ArrayList;

    move-object/from16 v17, v0

    move-object/from16 v0, v17

    move/from16 v1, p1

    invoke-virtual {v0, v1}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;

    move-result-object v5

    check-cast v5, Lde/dealdoktor/app/data/CommentDAO;

    .line 89
    .local v5, comment:Lde/dealdoktor/app/data/CommentDAO;
    move-object/from16 v16, p2

    .line 90
    .local v16, view:Landroid/view/View;
    move-object/from16 v0, p0

    iget-object v0, v0, Lde/dealdoktor/app/adapter/CommentsListAdapter;->context:Lde/dealdoktor/app/activities/Comments;

    move-object/from16 v17, v0

    const-string v18, "layout_inflater"

    invoke-virtual/range {v17 .. v18}, Lde/dealdoktor/app/activities/Comments;->getSystemService(Ljava/lang/String;)Ljava/lang/Object;

    move-result-object v11

    check-cast v11, Landroid/view/LayoutInflater;

    .line 91
    .local v11, infl:Landroid/view/LayoutInflater;
    if-nez v16, :cond_0

    .line 92
    const v17, 0x7f030011

    const/16 v18, 0x0

    move/from16 v0, v17

    move-object/from16 v1, v18

    invoke-virtual {v11, v0, v1}, Landroid/view/LayoutInflater;->inflate(ILandroid/view/ViewGroup;)Landroid/view/View;

    move-result-object v16

    .line 95
    :cond_0
    const-string v14, ""

    .line 96
    .local v14, titleString:Ljava/lang/String;
    move-object/from16 v0, p0

    iget-object v0, v0, Lde/dealdoktor/app/adapter/CommentsListAdapter;->posts:Ljava/util/ArrayList;

    move-object/from16 v17, v0

    invoke-virtual/range {v17 .. v17}, Ljava/util/ArrayList;->iterator()Ljava/util/Iterator;

    move-result-object v17

    :cond_1
    invoke-interface/range {v17 .. v17}, Ljava/util/Iterator;->hasNext()Z

    move-result v18

    if-nez v18, :cond_2

    .line 103
    :goto_0
    const v17, 0x7f0b0034

    invoke-virtual/range {v16 .. v17}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v9

    check-cast v9, Landroid/widget/ImageView;

    .line 104
    .local v9, gavatar:Landroid/widget/ImageView;
    const v17, 0x7f0b0035

    invoke-virtual/range {v16 .. v17}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v15

    check-cast v15, Landroid/widget/TextView;

    .line 105
    .local v15, user:Landroid/widget/TextView;
    const v17, 0x7f0b0038

    invoke-virtual/range {v16 .. v17}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v13

    check-cast v13, Landroid/widget/TextView;

    .line 108
    .local v13, title:Landroid/widget/TextView;
    const v17, 0x7f0b0039

    invoke-virtual/range {v16 .. v17}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v6

    check-cast v6, Landroid/widget/TextView;

    .line 109
    .local v6, content:Landroid/widget/TextView;
    const v17, 0x7f0b0037

    invoke-virtual/range {v16 .. v17}, Landroid/view/View;->findViewById(I)Landroid/view/View;

    move-result-object v7

    check-cast v7, Landroid/widget/TextView;

    .line 111
    .local v7, date:Landroid/widget/TextView;
    new-instance v17, Ljava/lang/StringBuilder;

    const-string v18, "<u>"

    invoke-direct/range {v17 .. v18}, Ljava/lang/StringBuilder;-><init>(Ljava/lang/String;)V

    move-object/from16 v0, v17

    invoke-virtual {v0, v14}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v17

    const-string v18, "</u>"

    invoke-virtual/range {v17 .. v18}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder;

    move-result-object v17

    invoke-virtual/range {v17 .. v17}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String;

    move-result-object v17

    invoke-static/range {v17 .. v17}, Landroid/text/Html;->fromHtml(Ljava/lang/String;)Landroid/text/Spanned;

    move-result-object v17

    move-object/from16 v0, v17

    invoke-virtual {v13, v0}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 113
    const-string v10, ""

    .line 115
    .local v10, gravatarUrl:Ljava/lang/String;
    :try_start_0
    new-instance v17, Ljava/net/URI;

    iget-object v0, v5, Lde/dealdoktor/app/data/CommentDAO;->icon:Ljava/lang/String;

    move-object/from16 v18, v0

    invoke-direct/range {v17 .. v18}, Ljava/net/URI;-><init>(Ljava/lang/String;)V

    invoke-virtual/range {v17 .. v17}, Ljava/net/URI;->toASCIIString()Ljava/lang/String;
    :try_end_0
    .catch Ljava/net/URISyntaxException; {:try_start_0 .. :try_end_0} :catch_0

    move-result-object v10

    .line 119
    :goto_1
    const-string v17, ""

    move-object/from16 v0, v17

    if-eq v10, v0, :cond_3

    .line 120
    const-string v17, "xxxxxx"

    move-object/from16 v0, v17

    invoke-static {v0, v10}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I

    .line 121
    move-object/from16 v0, p0

    iget-object v0, v0, Lde/dealdoktor/app/adapter/CommentsListAdapter;->asyncImageLoader:Lde/dealdoktor/app/util/AsyncImageLoader;

    move-object/from16 v17, v0

    new-instance v18, Lde/dealdoktor/app/adapter/CommentsListAdapter$1;

    move-object/from16 v0, v18

    move-object/from16 v1, p0

    invoke-direct {v0, v1, v9}, Lde/dealdoktor/app/adapter/CommentsListAdapter$1;-><init>(Lde/dealdoktor/app/adapter/CommentsListAdapter;Landroid/widget/ImageView;)V

    .line 125
    move-object/from16 v0, p0

    iget-object v0, v0, Lde/dealdoktor/app/adapter/CommentsListAdapter;->context:Lde/dealdoktor/app/activities/Comments;

    move-object/from16 v19, v0

    invoke-virtual/range {v19 .. v19}, Lde/dealdoktor/app/activities/Comments;->getResources()Landroid/content/res/Resources;

    move-result-object v19

    const v20, 0x7f02000a

    invoke-virtual/range {v19 .. v20}, Landroid/content/res/Resources;->getDrawable(I)Landroid/graphics/drawable/Drawable;

    move-result-object v19

    invoke-virtual {v5}, Ljava/lang/Object;->toString()Ljava/lang/String;

    move-result-object v20

    .line 121
    move-object/from16 v0, v17

    move-object/from16 v1, v18

    move-object/from16 v2, v19

    move-object/from16 v3, v20

    invoke-virtual {v0, v10, v1, v2, v3}, Lde/dealdoktor/app/util/AsyncImageLoader;->loadDrawable(Ljava/lang/String;Lde/dealdoktor/app/util/AsyncImageLoader$ImageCallbackDrawable;Landroid/graphics/drawable/Drawable;Ljava/lang/String;)Landroid/graphics/drawable/Drawable;

    move-result-object v4

    .line 127
    .local v4, cachedImage:Landroid/graphics/drawable/Drawable;
    invoke-virtual {v9, v4}, Landroid/widget/ImageView;->setImageDrawable(Landroid/graphics/drawable/Drawable;)V

    .line 132
    .end local v4           #cachedImage:Landroid/graphics/drawable/Drawable;
    :goto_2
    iget-object v0, v5, Lde/dealdoktor/app/data/CommentDAO;->user:Ljava/lang/String;

    move-object/from16 v17, v0

    move-object/from16 v0, v17

    invoke-virtual {v15, v0}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 135
    iget-object v0, v5, Lde/dealdoktor/app/data/CommentDAO;->content:Ljava/lang/String;

    move-object/from16 v17, v0

    const-string v18, "<img .*?>"

    const-string v19, ""

    invoke-virtual/range {v17 .. v19}, Ljava/lang/String;->replaceAll(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;

    move-result-object v17

    invoke-static/range {v17 .. v17}, Landroid/text/Html;->fromHtml(Ljava/lang/String;)Landroid/text/Spanned;

    move-result-object v17

    move-object/from16 v0, v17

    invoke-virtual {v6, v0}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 136
    iget-object v0, v5, Lde/dealdoktor/app/data/CommentDAO;->date:Ljava/lang/String;

    move-object/from16 v17, v0

    invoke-static/range {v17 .. v17}, Lde/dealdoktor/app/util/Util;->formatDate(Ljava/lang/String;)Ljava/lang/String;

    move-result-object v17

    move-object/from16 v0, v17

    invoke-virtual {v7, v0}, Landroid/widget/TextView;->setText(Ljava/lang/CharSequence;)V

    .line 138
    new-instance v17, Lde/dealdoktor/app/adapter/CommentsListAdapter$2;

    move-object/from16 v0, v17

    move-object/from16 v1, p0

    invoke-direct {v0, v1, v5}, Lde/dealdoktor/app/adapter/CommentsListAdapter$2;-><init>(Lde/dealdoktor/app/adapter/CommentsListAdapter;Lde/dealdoktor/app/data/CommentDAO;)V

    move-object/from16 v0, v17

    invoke-virtual {v13, v0}, Landroid/widget/TextView;->setOnClickListener(Landroid/view/View$OnClickListener;)V

    .line 156
    return-object v16

    .line 96
    .end local v6           #content:Landroid/widget/TextView;
    .end local v7           #date:Landroid/widget/TextView;
    .end local v9           #gavatar:Landroid/widget/ImageView;
    .end local v10           #gravatarUrl:Ljava/lang/String;
    .end local v13           #title:Landroid/widget/TextView;
    .end local v15           #user:Landroid/widget/TextView;
    :cond_2
    invoke-interface/range {v17 .. v17}, Ljava/util/Iterator;->next()Ljava/lang/Object;

    move-result-object v12

    check-cast v12, Lde/dealdoktor/app/data/PostDAO;

    .line 97
    .local v12, post:Lde/dealdoktor/app/data/PostDAO;
    iget v0, v12, Lde/dealdoktor/app/data/PostDAO;->id:I

    move/from16 v18, v0

    invoke-static/range {v18 .. v18}, Ljava/lang/String;->valueOf(I)Ljava/lang/String;

    move-result-object v18

    iget-object v0, v5, Lde/dealdoktor/app/data/CommentDAO;->postId:Ljava/lang/String;

    move-object/from16 v19, v0

    invoke-virtual/range {v18 .. v19}, Ljava/lang/String;->equals(Ljava/lang/Object;)Z

    move-result v18

    if-eqz v18, :cond_1

    .line 98
    iget-object v14, v12, Lde/dealdoktor/app/data/PostDAO;->title:Ljava/lang/String;

    .line 99
    goto/16 :goto_0

    .line 116
    .end local v12           #post:Lde/dealdoktor/app/data/PostDAO;
    .restart local v6       #content:Landroid/widget/TextView;
    .restart local v7       #date:Landroid/widget/TextView;
    .restart local v9       #gavatar:Landroid/widget/ImageView;
    .restart local v10       #gravatarUrl:Ljava/lang/String;
    .restart local v13       #title:Landroid/widget/TextView;
    .restart local v15       #user:Landroid/widget/TextView;
    :catch_0
    move-exception v8

    .line 117
    .local v8, e:Ljava/net/URISyntaxException;
    const-string v17, "exception"

    const-string v18, "PostListing getView"

    move-object/from16 v0, v17

    move-object/from16 v1, v18

    invoke-static {v0, v1, v8}, Landroid/util/Log;->e(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I

    goto/16 :goto_1

    .line 129
    .end local v8           #e:Ljava/net/URISyntaxException;
    :cond_3
    move-object/from16 v0, p0

    iget-object v0, v0, Lde/dealdoktor/app/adapter/CommentsListAdapter;->defaultBitmap:Landroid/graphics/Bitmap;

    move-object/from16 v17, v0

    move-object/from16 v0, v17

    invoke-virtual {v9, v0}, Landroid/widget/ImageView;->setImageBitmap(Landroid/graphics/Bitmap;)V

    goto :goto_2
.end method
